package com.ruoyi.system.service.impl;

import java.util.List;
import com.ruoyi.common.core.utils.DateUtils;
import com.ruoyi.system.domain.vo.WarehousePositionVo;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import com.ruoyi.system.mapper.WarehousePositionMapper;
import com.ruoyi.system.domain.WarehousePosition;
import com.ruoyi.system.service.IWarehousePositionService;

/**
 * 仓位Service业务层处理
 * 
 * @author ruoyi
 * @date 2025-01-18
 */
@Service
public class WarehousePositionServiceImpl implements IWarehousePositionService 
{
    @Autowired
    private WarehousePositionMapper warehousePositionMapper;

    /**
     * 查询仓位
     * 
     * @param id 仓位主键
     * @return 仓位
     */
    @Override
    public WarehousePosition selectWarehousePositionById(Long id)
    {
        return warehousePositionMapper.selectWarehousePositionById(id);
    }

    /**
     * 查询仓位列表
     * 
     * @param warehousePosition 仓位
     * @return 仓位
     */
    @Override
    public List<WarehousePositionVo> selectWarehousePositionList(WarehousePosition warehousePosition)
    {
        return warehousePositionMapper.selectWarehousePositionList(warehousePosition);
    }

    /**
     * 新增仓位
     * 
     * @param warehousePosition 仓位
     * @return 结果
     */
    @Override
    public int insertWarehousePosition(WarehousePosition warehousePosition)
    {
        warehousePosition.setCreateTime(DateUtils.getNowDate());
        return warehousePositionMapper.insertWarehousePosition(warehousePosition);
    }

    /**
     * 修改仓位
     * 
     * @param warehousePosition 仓位
     * @return 结果
     */
    @Override
    public int updateWarehousePosition(WarehousePosition warehousePosition)
    {
        return warehousePositionMapper.updateWarehousePosition(warehousePosition);
    }

    /**
     * 批量删除仓位
     * 
     * @param ids 需要删除的仓位主键
     * @return 结果
     */
    @Override
    public int deleteWarehousePositionByIds(Long[] ids)
    {
        return warehousePositionMapper.deleteWarehousePositionByIds(ids);
    }

    /**
     * 删除仓位信息
     * 
     * @param id 仓位主键
     * @return 结果
     */
    @Override
    public int deleteWarehousePositionById(Long id)
    {
        return warehousePositionMapper.deleteWarehousePositionById(id);
    }

    @Override
    public List<WarehousePosition> findALl() {
        return warehousePositionMapper.findAll();
    }
}
